Artificial intelligence (AI) can enable computers to perform various complicated tasks, such as those related to cognitive functions that are typically associated with humans. These functions often involve making predictions or assessments based on real-world inputs. Several approaches to AI are prevalent, including machine learning techniques. Machine learning systems, in at least some examples, may be trained using known data sets rather than employing a specific predetermined algorithm to perform a task.
Some machine learning systems naturally lend themselves to be compiled for execution on static (e.g., unchanging and/or unconditional) processing structures. One machine learning model, referred to as an artificial neural network (ANN), is inspired by the interconnections of neurons in a biological brain. Typically, ANNs include multiple computational nodes arranged in interconnected layers, with each node modeling a neuron that may receive one or more inputs, process the inputs, and pass an output to the next layer, with the final layer producing a desired output. Some ANNs are easily compiled into directed acyclic graphs (DAGs) implemented by a group of processing elements on general-purpose or special-purpose hardware. Unlike many types of computer algorithms, DAGs typically do not implement execution loops, conditional branches, or the like.
However, some ANNs and other machine learning systems are best represented by processing networks that include the more complex looping and branching structures noted above. For example, a class of ANNs called recurrent neural networks (RNNs) employ execution loops, such as by forwarding an output of one layer to the same layer and/or a preceding layer. Such iterative processing is useful in some complex tasks. For example, natural language processing (NLP) (e.g., machine translation) networks often employ knowledge of sequential information, such as how many previous words encountered in a sentence may be used to translate the current word. To facilitate this capability, some information regarding the preceding words may be saved for subsequent processing of the current word. Such information is typically modeled by way of loops or other recurring constructs of an RNN.
To render the resulting RNN more efficient, neural network compilers may model at least some of the desired dynamic traits of an RNN into a more static network, which may be accomplished by “unrolling” looping constructs into a series of similar neural layers more commonly used in a DAG. One consequence of rendering such a loop in a static manner is that early termination of the loop, which may be desirable under certain circumstances (e.g., in machine translation, if the end of the current sentence is encountered), may be difficult without some type of conditional execution, such as a branch in the network.